<template>
  <div class="app-container">
    <el-button icon="el-icon-question" type="primary" @click.prevent.stop="guide">
      系统教学引导
    </el-button>
  </div>
</template>

<script>
import Driver from 'driver.js' // import driver.js
import 'driver.js/dist/driver.min.css' // import driver.js css
import steps from './steps'
import { addMessageHandler } from '@/utils/websocket'

export default {
  name: 'Guide',
  data() {
    return {
      driver: null
    }
  },
  mounted() {
    this.driver = new Driver()
  },
  created() {
    // 注册页面消息处理器
    addMessageHandler('hubBaseInfo', (message) => {
      console.log('引导页消息处理器2', message.data.clients)
      this.clients = message.data.clients
    })
  },
  methods: {
    guide() {
      this.driver.defineSteps(steps)
      this.driver.start()
    }
  }
}
</script>
